@size: 12px;

.switch {
  display: flex;
  justify-content: flex-end;
}

.cmn-toggle {
  position: absolute;
  margin-left: -9999px;
  visibility: hidden;
  width: 0;
  height: 0;
}

.cmn-toggle + label {
  display: block;
  position: relative;
  cursor: pointer;
  outline: none;
  user-select: none;
}

input.cmn-toggle-round + label {
  padding: 2px;
  width: @size * 4;
  height: @size * 2;
  background-color: #dddddd;
  border-radius: @size * 2;
}

input.cmn-toggle-round + label:before,
input.cmn-toggle-round + label:after {
  font-size: 12px;
  display: flex;
  position: absolute;
  top: 1px;
  left: 1px;
  bottom: 1px;
  color: #333;
}

input.cmn-toggle-round + label:before {
  content: "";
  right: 1px;
  background-color: #f1f1f1;
  border-radius: @size * 2;
  transition: background 0.4s;
}

input.cmn-toggle-round + label:after {
  content: "关";
  justify-content: center;
  align-items: center;
  width: @size * 2 - 2px;
  background-color: #fff;
  border-radius: 100%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: left 0.4s;
  border: 1px solid #ccc;
}

input.cmn-toggle-round:checked + label:before {
  background-color: #8ce196;
  border: 1px solid #70e17b;
}

input.cmn-toggle-round:checked + label:after {
  content: "开";
  color: #1daf36;
  left: calc(100% - @size - @size);
}